﻿@model FCNS.ERP.Models.ErpProductPack

@{
    ViewBag.Title = "商品套餐-新增";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal"> 
        <div class="row">
            <div class="col-sm-4">
                <div class="form-group">
                    @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control", @onClick = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" } })
                        @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>
          
            <div class="col-sm-4">
                <div class="form-group">
                    @Html.LabelFor(model => model.DateTimeStart, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.DateTimeStart, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.DateTimeStart, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>

            <div class="col-sm-4">
                <div class="form-group">
                    @Html.LabelFor(model => model.DateTimeEnd, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.DateTimeEnd, new { htmlAttributes = new { @class = "form-control"  } })
                        @Html.ValidationMessageFor(model => model.DateTimeEnd, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>
        </div>
         

        <hr />
        <div class="form-inline">
            <input type="button" value="保存" id="SaveOrder" class="btn btn-success" />&nbsp;&nbsp;&nbsp;&nbsp;
            <div class="form-group">
                <input type="text" id="InputCode" class="form-control text-box single-line" />
            </div>
            &nbsp;&nbsp;&nbsp;<input type="button" value="加载" id="LoadProduct" class="btn btn-info" />
        </div>

        <div id="tableDetail">
            <table class="display">
                <thead>
                    <tr>
                        <th>编码</th>
                        <th>条形码</th>
                        <th>名称</th>
                        <th>单位</th> 
                        <th>数量</th> 
                        <th></th>
                    </tr>
                </thead>
                <tbody></tbody>  
            </table>
        </div>
    </div>
} 
 
<script src="/Scripts/Erp/defineDataTable.js"></script>
<script type="text/javascript">
    $(document).ready(function () { 

        InitDataTable();
        $("#tableDetail tbody").empty();

        $("#SaveOrder").click(function () {
            var p = FormatProductList();
            if (p == "") {
                alert("商品列表不能为空");
            } 
            else {
                $("form").attr("action", "/Basic/ProductPackNew?productList=" + p).submit();
            }
        });

    });
</script>



